package com.tcs.gamed.shared.model;

import java.util.Date;

import com.google.gwt.user.client.rpc.IsSerializable;

public class FolderItem implements IsSerializable {

    private String key;
    private String name;
    private ItemType type;
    private Date updatedAt;
    private Date createdAt;
    private String comment;
    private String parentKey;
    
    public FolderItem() {}

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public ItemType getType() {
        return type;
    }

    public void setType(ItemType type) {
        this.type = type;
    }

    public Date getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Date updatedAt) {
        this.updatedAt = updatedAt;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public String getParentKey() {
        return parentKey;
    }

    public void setParentKey(String parentKey) {
        this.parentKey = parentKey;
    }

    @Override
    public boolean equals(Object obj) {
        if(obj == this) {
            return true;
        }
        if(!(obj instanceof FolderItem)) {
            return false;
        }
        return getKey().equals(((FolderItem) obj).getKey());
    }

    @Override
    public int hashCode() {
        final String key = getKey();
        return (key == null) ? super.hashCode() : key.hashCode();
    }

    @Override
    public String toString() {
        final StringBuilder buf = new StringBuilder();
        buf.append("name:")
           .append(getName())
           .append(" type:")
           .append(getType())
           .append(" key:")
           .append(getKey())
           .append(" parent:")
           .append(getParentKey());
        return buf.toString();
    }
}
